package com.salesmanager.core.business.customer.model.account;

import com.salesmanager.core.business.customer.model.Customer;
import com.salesmanager.core.business.generic.model.SalesManagerEntity;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by Liutong on 2/22/16.
 * 账户历史表 ，记录详细的账户变化
 */
@Entity
@Table(name = "CUSTOMER_ACCOUNT_DETAILS")
public class CustomerAccountDetails extends SalesManagerEntity<Long,CustomerAccountDetails> {

    @Id
    @Column(name = "ACCOUNT_DETAILS_ID", unique=true, nullable=false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CUSTOMER_ID",nullable = false)
    private Customer customer;//用户

    @Column(name = "DATE_CREATED")
    private Date dateCreated;//创建时间


    @Column(name = "DATE_MODIFIED")
    private Date dateModified;

    @Column(name = "TITLE")
    private String title;

    @Column(name = "OPERATION_TYPE",columnDefinition = "int(1) COMMENT '操作类型 1:收入 2:支出'")
    private Integer operationType;//操作类型

    @Column(name = "OPERATION_AMOUNT",columnDefinition = "decimal(19,2) COMMENT '操作数量'")
    private BigDecimal operationAmount;//操作数量

    @Column(name = "BALANCE",columnDefinition = "decimal(19,2) COMMENT '操作后的余额'")
    private BigDecimal balance;//操作后的余额

    @Column(name = "OPERATION_DETAILS",columnDefinition = "int(2) COMMENT '操作详情 当OPERATION_TYPE=1 1:返利 ; 当OPERATION_TYPE=2 1:兑换集分宝 2:微信钱包提现 3:话费充值'")
    private Integer operationDetails;

    @Column(name = "INVALID_DATE")
    private Date invalidDate;//失效日期

    @Column(name = "REMARK")
    private String remark; //备注字段

    @Column(name = "PHONENUM")
    private String phoneNum; //充值手机号

    @Column(name = "CHECK_STATUS",columnDefinition = "int(1) COMMENT '1:审核中2:审核拒绝3:审核通过'")
    private Integer checkStatus; //备注字段

    @Column(name = "TAG",columnDefinition = "int(1) COMMENT '标识字段'")
    private Integer tag;


    @Override
    public Long getId() {
        return this.id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public Integer getCheckStatus() {
        return checkStatus;
    }

    public void setCheckStatus(Integer checkStatus) {
        this.checkStatus = checkStatus;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Date getInvalidDate() {
        return invalidDate;
    }

    public void setInvalidDate(Date invalidDate) {
        this.invalidDate = invalidDate;
    }

    public Integer getTag() {
        return tag;
    }

    public void setTag(Integer tag) {
        this.tag = tag;
    }

    public Integer getOperationType() {
        return operationType;
    }

    public void setOperationType(Integer operationType) {
        this.operationType = operationType;
    }

    public BigDecimal getOperationAmount() {
        return operationAmount;
    }

    public void setOperationAmount(BigDecimal operationAmount) {
        this.operationAmount = operationAmount;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getOperationDetails() {
        return operationDetails;
    }

    public void setOperationDetails(Integer operationDetails) {
        this.operationDetails = operationDetails;
    }

    public Date getDateModified() {
        return dateModified;
    }

    public void setDateModified(Date dateModified) {
        this.dateModified = dateModified;
    }
}
